package com.baitiaojun.user.api;

import com.baitiaojun.api.domain.user.User;
import com.baitiaojun.api.exception.ConditionException;
import com.baitiaojun.api.vo.JsonRes;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @类名 SystemController
 * @描述 TODO
 * @作者 白条君
 * @创建日期 2022/11/20 13:22
 * @版本 1.0
 */
@Api("登录和注销接口")
@RequestMapping("/user/system")
public interface SystemApi {

    @ApiOperation("获取公钥")
    @GetMapping("/rsa-public-key")
    JsonRes getRSAPublicKey();

    @ApiOperation("注册新用户")
    @PostMapping("/new-user")
    JsonRes register(@ApiParam(value = "用户实体", required = true) @Valid @RequestBody User user, BindingResult result) throws Exception;

    @ApiOperation("用户登录")
    @PostMapping("/login")
    JsonRes login(@ApiParam(value = "用户实体", required = true) @Valid @RequestBody User user, BindingResult result) throws Exception;

    @ApiOperation("用户注销")
    @DeleteMapping("/cancellation")
    JsonRes cancellation();
}
